<div bsModal #createOrEditModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
    aria-labelledby="createOrEditModal" aria-hidden="true" [config]="{backdrop: 'static'}">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <form *ngIf="active" #editForm="ngForm" novalidate (ngSubmit)="saveall()" autocomplete="off">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="order.id">编辑更改单信息</span>
                        <span *ngIf="!order.id">创建更改单信息</span>
                    </h4>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>

                <div class="modal-body">
                    <div class="primeng-datatable-container" [busyIf]="isLoading">
                        <div class="m-portlet" style="margin-top: -10px;">
                            <div class="m-portlet__head" style="height: 50px; padding: 15px;">
                                <div class="m-portlet__head-caption">
                                    <div class="m-portlet__head-title">
                                        <div class="col-xs-6 text-left">
                                            <button type="button" (click)="AddAlterItem.show(orderitems)"
                                                class="btn btn-primary blue">
                                                <i class="fa fa-plus"></i> 添加文件
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="m-portlet__body" style="padding: 15px;">
                                <div class="row">
                                    <div class="col-md-6">
                                        <label>更改单编码
                                            <span class="text-danger">*</span>
                                        </label>
                                        <div class="form-group form-md-line-input form-md-floating-label no-hint">
                                            <input class="form-control" name="alterationInvoiceCode"
                                                [ngClass]="{'edited': order.alterationInvoiceCode}"
                                                [(ngModel)]="order.alterationInvoiceCode" required>
                                        </div>
                                    </div>
                                </div>
                                <!--<Primeng-TurboTable-Start>-->
                                <p-table #dt [value]="orderitems" selectionMode="single" [(selection)]="selectedContact"
                                    (onRowSelect)="onRowSelect($event)" [paginator]="false">

                                    <ng-template pTemplate="header">
                                        <tr>
                                            <th>
                                                文件名称
                                            </th>
                                            <th>
                                                型号
                                            </th>
                                            <th>
                                                图号
                                            </th>
                                            <th>
                                                图号名称
                                            </th>
                                            <th>
                                                部段号
                                            </th>
                                            <th>
                                                操作
                                            </th>
                                        </tr>
                                    </ng-template>
                                    <ng-template pTemplate="body" let-rowData let-record="$implicit">
                                        <tr [pSelectableRow]="rowData" class="">
                                            <td>
                                                {{rowData.newTechFileInfo.fileName}}
                                            </td>
                                            <td>
                                                {{rowData.newTechFileInfo.modelName}}
                                            </td>
                                            <td>
                                                {{rowData.newTechFileInfo.drawingCode}}
                                            </td>
                                            <td>
                                                {{rowData.newTechFileInfo.drawingName}}
                                            </td>
                                            <td>
                                                {{rowData.newTechFileInfo.paragraphNo}}
                                            </td>
                                            <td>
                                                <button type="button" class="btn btn-warning btn-sm"
                                                    style="font-size: .875rem !important;"
                                                    (click)="delete(rowData.newTechFileInfo.id,rowData.oldTechFileInfoId)">
                                                    移除
                                                </button>
                                            </td>
                                        </tr>
                                    </ng-template>
                                </p-table>
                                <div class="primeng-no-data" *ngIf="orderitems.length == 0">
                                    {{'NoData' | localize}}
                                </div>
                                <!--<Primeng-TurboTable-End>-->
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-default"
                        (click)="close()">{{l("Cancel")}}</button>
                    <button type="submit" class="btn btn-primary blue" [disabled]="!editForm.form.valid"
                        [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')">
                        <i class="fa fa-save"></i>
                        <span>{{l("Save")}}</span>
                    </button>
                </div>
            </form>
        </div>
    </div>
    <AddAlterItem #AddAlterItem (modalSave)="reload($event)"></AddAlterItem>
    <EditAlteration #EditAlteration></EditAlteration>
</div>